<?php

Route::get('/', 'IndexController@index');

Route::get('register', function () {
    return view('register');
});

Route::get('product/list/{id}', 'ListController@product')
    ->name('productList');

Route::get('product/search', 'ListController@search');

Route::get('product/content/{id}', 'ContentController@product')
    ->name('productContent');

Route::get('article/list/{id}', 'ListController@article')
    ->name('articleList');

Route::get('article/content/{id}', 'ContentController@article')
    ->name('articleContent');

Route::get('article_type/content/{id}', 'ContentController@articleType')
    ->name('articleTypeContent');

Route::get('article_type/content_img/{id}', 'ContentController@articleTypeImg')
    ->name('articleTypeContentImg');

//后台路由

Route::get('admin/login', 'Admin\LoginController@index');
Route::post('admin/doLogin', 'Admin\LoginController@doLogin');

Route::group(['prefix' => 'admin', 'middleware' => 'isLogin', 'namespace' => 'Admin'], function () {

    Route::get('/', 'IndexController@index');
    Route::get('logout', 'IndexController@logout');

    //焦点图管理
    Route::get('focus_img', 'FocusImgController@index');
    Route::any('focus_img/add', 'FocusImgController@add');
    Route::post('focus_img/del', 'FocusImgController@del');

    //产品管理
    Route::get('product_type', 'ProductTypeController@index');
    Route::any('product_type/add', 'ProductTypeController@add');
    Route::post('product_type/del', 'ProductTypeController@del');
    Route::any('product_type/edit/{id}', 'ProductTypeController@edit')->name('productTypeEdit');
    Route::get('product', 'ProductController@index');
    Route::any('product/add', 'ProductController@add');
    Route::post('product/del', 'ProductController@del');
    Route::any('product/edit/{id}', 'ProductController@edit')->name('productEdit');

    //内容管理
    Route::get('article_type', 'ArticleTypeController@index');
    Route::any('article_type/add', 'ArticleTypeController@add');
    Route::post('article_type/del', 'ArticleTypeController@del');
    Route::any('article_type/edit/{id}', 'ArticleTypeController@edit')->name('articleTypeEdit');
    Route::get('article', 'ArticleController@index');
    Route::any('article/add', 'ArticleController@add');
    Route::post('article/del', 'ArticleController@del');
    Route::any('article/edit/{id}', 'ArticleController@edit')->name('articleEdit');

    //管理员管理
    Route::get('member', 'MemberController@index');
    Route::any('member/add', 'MemberController@add');
    Route::post('member/del', 'MemberController@del');
    Route::any('member/edit/{id}', 'MemberController@edit')->name('memberEdit');
});

